package com.meta.builder.freemarker.tmp;


import com.meta.builder.freemarker.cls.ClassBuilder;

/**
 * 类型枚举
 *
 * @author matevip
 * @date 2023/8/13
 * @wechat lwh
 */
public enum ClassTypeTmpEnum {
    OBJECT("object", "实体类", "object", "", ClassBuilder.class),
    ARRAY("array", "数组", "List<String>", "import java.util.List;", null),
    INTEGER("integer", "整形", "Integer", "", null),
    BOOLEAN("boolean", "布尔", "Boolean", "", null),
    STRING("string", "字符串", "String", "", null),
    NUMBER("number", "数字", "Number", "", null);
    private String code;
    private String name;
    private String cls;
    private String imports;
    private Class builder;

    ClassTypeTmpEnum(String code, String name, String cls, String imports, Class builder) {
        this.code = code;
        this.name = name;
        this.cls = cls;
        this.imports = imports;
        this.builder = builder;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getCls() {
        return cls;
    }

    public String getImports() {
        return imports;
    }

    public static ClassTypeTmpEnum typeOf(String code) {
        ClassTypeTmpEnum classTypeTmpEnum = STRING;
        for (ClassTypeTmpEnum value : values()) {
            if (value.getCode().equals(code)) {
                classTypeTmpEnum = value;
            }
        }
        return classTypeTmpEnum;
    }

    public Class getBuilder() {
        return builder;
    }

    public void setBuilder(Class builder) {
        this.builder = builder;
    }
}
